//
//  ZXHTTPManager.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/11/26.
//  Copyright © 2016年 stone. All rights reserved.
//

#import "NSDate+TimeStamp.h"
#import "ZXHTTPManager.h"
@import Darwin.POSIX.netinet.in;
#import "ConstValues.h"
#define BaseUrl @"https://www.zhuoyinong.com:444/"
@implementation ZXHTTPManager
+ (instancetype)sharedManager {
    static ZXHTTPManager * _manager;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        /** 麻痹 基础地质 注掉了 , 当然没有内容数据 草 */
        NSURL * url = [NSURL URLWithString:BaseUrl];
        
        _manager = [[self alloc] initWithBaseURL:url];
        
        //加上ssl验证
        [_manager setSecurityPolicy:[self customSecurityPolicy]];
        
        _manager.responseSerializer = [ZXHTTPResponseSerializer serializer];
        
        _manager.requestSerializer = [ZXJSONRequestSerializer serializer];
        
        NSSet * set = [NSSet setWithObjects:@"text/html", @"application/json", @"text/plain", @"text/json", nil];
        
        _manager.responseSerializer.acceptableContentTypes = [_manager.responseSerializer.acceptableContentTypes setByAddingObjectsFromSet:set];
        
    });
    
    return _manager;
}



+ (instancetype)sharedManagerNOCer {
    static ZXHTTPManager * _managerNOCer;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        /** 麻痹 基础地质 注掉了 , 当然没有内容数据 草 */
        NSURL * url = [NSURL URLWithString:BaseUrl];
        
        _managerNOCer = [[self alloc] initWithBaseURL:url];
        
        _managerNOCer.responseSerializer = [ZXHTTPResponseSerializer serializer];
        
        _managerNOCer.requestSerializer = [ZXJSONRequestSerializer serializer];
        
        NSSet * set = [NSSet setWithObjects:@"text/html", @"application/json", @"text/plain", @"text/json", nil];
        
        _managerNOCer.responseSerializer.acceptableContentTypes = [_managerNOCer.responseSerializer.acceptableContentTypes setByAddingObjectsFromSet:set];
        
    });
    
    return _managerNOCer;
}








#pragma mark -
#pragma mark 私有方法
+ (ZXSecurityPolicy*)customSecurityPolicy
{
    // /先导入证书
    NSString *cerName = @"zhuoyinong.com";
    
    NSString *cerPath = [[NSBundle mainBundle] pathForResource:cerName ofType:@"cer"];//证书的路径
    NSData *certData = [NSData dataWithContentsOfFile:cerPath];
    
    // AFSSLPinningModeCertificate 使用证书验证模式
    ZXSecurityPolicy *securityPolicy = [ZXSecurityPolicy policyWithPinningMode:ZXSSLPinningModeCertificate];
    // allowInvalidCertificates 是否允许无效证书（也就是自建的证书），默认为NO
    // 如果是需要验证自建证书，需要设置为YES
    securityPolicy.allowInvalidCertificates = YES;
    
    //validatesDomainName 是否需要验证域名，默认为YES；
    
    securityPolicy.validatesDomainName = NO;
    
    securityPolicy.pinnedCertificates = @[certData];
    return securityPolicy;
}






//sn_note:========= 异步 判断是否断网 ============================ stone 🐳 ===========/
+ (void)startMonitoring {
    ZXNetworkReachabilityManager * manager = [ZXNetworkReachabilityManager sharedManager];
    [manager setReachabilityStatusChangeBlock:^(ZXNetworkReachabilityStatus status) {
        // 当网络状态发生改变的时候调用这个block
        switch (status) {
            case ZXNetworkReachabilityStatusReachableViaWiFi:
                NSLog(@"WIFI");
                [[NSNotificationCenter defaultCenter] postNotificationName:WiFiNotification object:nil userInfo:nil];
                
                break;
                
            case ZXNetworkReachabilityStatusReachableViaWWAN:
                NSLog(@"自带网络");
                [[NSNotificationCenter defaultCenter] postNotificationName:WWANNotification object:nil userInfo:nil];
                
                break;
                
            case ZXNetworkReachabilityStatusNotReachable:
                NSLog(@"没有网络");
                [[NSNotificationCenter defaultCenter] postNotificationName:NotReachableNotification object:nil userInfo:nil];
                
                break;
                
            case ZXNetworkReachabilityStatusUnknown:
                NSLog(@"未知网络");
                [[NSNotificationCenter defaultCenter] postNotificationName:UnknownNotification object:nil userInfo:nil];
                
                break;
            default:
                break;
        }
    }];
    // 开始监控
    [manager startMonitoring];
}
/** 同步判断是否有网络 */
+ (BOOL)connectedToNetwork {
    //创建零地址，0.0.0.0的地址表示查询本机的网络连接状态
    struct sockaddr_in zeroAddress;
    bzero(&zeroAddress, sizeof(zeroAddress));
    zeroAddress.sin_len = sizeof(zeroAddress);
    zeroAddress.sin_family = AF_INET;
    // Recover reachability flags
    SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
    SCNetworkReachabilityFlags flags;
    //获得连接的标志
    BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
    CFRelease(defaultRouteReachability);
    
    //如果不能获取连接标志，则不能连接网络，直接返回
    if (!didRetrieveFlags) {
        return NO;
    }
    //根据获得的连接标志进行判断
    BOOL isReachable = flags & kSCNetworkFlagsReachable;
    BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
    return (isReachable && !needsConnection) ? YES : NO;
}

//封装 get & post 请求方法
- (void)requestWithMethod:(HTTPMethods)method urlString:(NSString *)urlString parameters:(NSDictionary *)parameters completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed {
    
    if (![ZXHTTPManager connectedToNetwork]) {
        
        return;
    }
    
    void (^success)(NSURLSessionDataTask * task, id result) = ^(NSURLSessionDataTask * task, id result) {
        
        if (result == nil) {
            //数据请求失败
            NSError *error = [[NSError alloc]initWithDomain:@"网络请求数据为空!" code:9999 userInfo:nil];
            completed(nil, error);
        }else{
            // NSJSONReadingAllowFragments
            NSDictionary * jsonDict = [NSJSONSerialization JSONObjectWithData:result options:kNilOptions error:nil];
            
            completed(jsonDict, nil);
        }
        
    };
    void (^failure)(NSURLSessionDataTask * task, NSError * error) = ^(NSURLSessionDataTask * task, NSError * error) {
        completed(nil, error);
    };
    
    switch (method) {
        case GET:
            [self GET:urlString parameters:parameters progress:nil success:success failure:failure];
            break;
        case POST:
            [self POST:urlString parameters:parameters progress:nil success:success failure:failure];
            break;
        case PUT:
            [self PUT:urlString parameters:parameters success:success failure:failure];
            break;
        case PATCH:
            [self PATCH:urlString parameters:parameters success:success failure:failure];
            break;
        case DELETE:
            [self DELETE:urlString parameters:parameters success:success failure:failure];
            break;
        default:
            break;
    }
}
//取消所有请求
- (void)cancelHTTPRequestOperations{
    [self.tasks makeObjectsPerformSelector:@selector(cancel)];
}
//sn_note:=========  ============================ stone 🐳 ===========/
/** 下载 */
- (NSURLSessionDownloadTask *)downloadWithUrl:(NSString *)url saveToPath:(NSString *)saveToPath progress:(ZXDownloadProgress)progressBlock success:(ZXResponseSuccess)success failure:(ZXResponseFail)failure{
    
    if (self.baseURL == nil) {
        if ([NSURL URLWithString:url] == nil) {
            NSLog(@"URLString无效，无法生成URL。可能是URL中有中文，请尝试Encode URL");
            return nil;
        }
    } else {
        if ([NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.baseURL, url]] == nil) {
            NSLog(@"URLString无效，无法生成URL。可能是URL中有中文，请尝试Encode URL");
            return nil;
        }
    }
    
    NSURLRequest *downloadRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    
    NSURLSessionDownloadTask *session = [self downloadTaskWithRequest:downloadRequest progress:^(NSProgress * _Nonnull downloadProgress) {
        
        if (progressBlock) {progressBlock(downloadProgress.completedUnitCount, downloadProgress.totalUnitCount);}
        
    } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
        
        return [NSURL fileURLWithPath:saveToPath];
        
    } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
        
        if (error == nil) {
            
            if (success) {
                
                success(filePath.absoluteString);
            }
        } else {
            
            NSLog(@"Download fail for url %@, reason : %@",url,[error description]);
        }
    }];
    
    [session resume];
    
    return session;
}
- (NSURLSessionUploadTask *)uploadFileWithUrl:(NSString *)url uploadingFile:(NSString *)uploadingFile progress:(ZXUploadProgress)progress success:(ZXResponseSuccess)success fail:(ZXResponseFail)fail{
    
    if ([NSURL URLWithString:uploadingFile] == nil) {
        NSLog(@"uploadingFile无效，无法生成URL。请检查待上传文件是否存在");
        return nil;
    }
    
    NSURL *uploadURL = nil;
    if (self.baseURL == nil) {
        uploadURL = [NSURL URLWithString:url];
    } else {
        uploadURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.baseURL, url]];
    }
    
    if (uploadURL == nil) {
        NSLog(@"URLString无效，无法生成URL。可能是URL中有中文或特殊字符，请尝试Encode URL");
        return nil;
    }
    
    
    NSURLRequest *request = [NSURLRequest requestWithURL:uploadURL];
    
    NSURLSessionUploadTask * session = [self uploadTaskWithRequest:request fromFile:[NSURL URLWithString:uploadingFile] progress:^(NSProgress * _Nonnull uploadProgress) {
        if (progress) {progress(uploadProgress.completedUnitCount, uploadProgress.totalUnitCount);}
    } completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
        
        if (error) {
            NSLog(@"error = %@",error);
        } else {
            success(responseObject);
        }
    }];
    
    return session;
}


/**
 登录接口
 
 @param userId 用户id
 @param password 密码
 @param completed 接口回调
 */
- (void)loginWith:(NSString *)userId passWord:(NSString *)password completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed {
    
    //需设置请求头
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSDictionary *param = @{
                            @"account":userId,
                            @"password":password,
                            @"deviceId":@"deviceId",//???uuid?
                            @"deviceToken":@"deviceToken",
                            @"accessToken":@"APP",
                            @"unionId":@"APP",
                            @"flowSource":@"APP",
                            @"inIp":@"APP",
                            @"inCnt":@"APP",
                            //                            @"inTime":@"123123"
                            };
    
    [self requestWithMethod:POST urlString:@"https://www.zhuoyinong.com:444/hzsmng/rest/login" parameters:param completed:completed];
}

//获取token
- (void)getTokenWithUserId:(NSString *)userId userName:(NSString *)userName idCard:(NSString *)idCard phone:(NSString *)phone password:(NSString *)password role:(NSString *)role completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed {
    /*
     {
     "deviceType": "Android",
     "deviceid": "861945037428889",
     "idCard": "",
     "loginName": "18899002211",
     "name": "18899002211",
     "password": "999999a",
     "role": "5",
     "userId": "a7b6770a496b46df8250613129a666bb",
     "userName": "关福"
     }
     */
    NSMutableDictionary * prameters = [NSMutableDictionary dictionary];
    prameters[@"deviceType"] = @"ios";
    prameters[@"deviceid"] = [SNUtils calculateUUID];
    prameters[@"idCard"] = idCard;
    prameters[@"loginName"] = phone;
    prameters[@"name"] = phone;
    prameters[@"password"] = password;
    prameters[@"role"] = role;
    
    prameters[@"userId"] = userId;
    
    prameters[@"userName"] = userName;
    
    NSLog(@"prameters = %@",prameters);
    //需设置请求头
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    [[self requestSerializer]setValue:nil forHTTPHeaderField:@"Authorization"];
    [self requestWithMethod:POST urlString:@"http://139.129.199.137:8080/resources/api/v1/rbac/auth/login" parameters:prameters completed:completed];
}

//获取轮播
- (void)getCycleViewDataCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    //    NSLog(@"[[NSUserDefaults standardUserDefaults] = %@",[[NSUserDefaults standardUserDefaults] valueForKey:@"token_key"]);
    //需要先设置请求头才能正常获取数据
    [[self requestSerializer]setValue:[[NSUserDefaults standardUserDefaults] valueForKey:@"token_key"] forHTTPHeaderField:@"Authorization"];
    NSLog(@"[ZXTokenManager sharedManager].token = %@",[ZXTokenManager sharedManager].token);
    
    [self requestWithMethod:GET urlString:@"http://139.129.199.137:8080/resources/api/v1/advertisement/top/" parameters:nil completed:completed];
}

//5.接口名称: 获取个人首页九宫格
//请求方式：GET
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/{userId}/{role}
- (void)getHomeConfWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    
    
    NSString *urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/HomeConf/%@/%@",kUserInfo.userId,kUserInfo.role];
    
    [self requestWithMethod:GET urlString:urlString parameters:nil completed:completed];
}
//.接口名称: 进入配置九宫格页面，获取所有九宫格
//请求方式：GET
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/all/{userId}/{role}
- (void)getHomeConfAllWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    
    
    NSString *urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/HomeConf/all/%@/%@",kUserInfo.userId,kUserInfo.role];
    
    [self requestWithMethod:GET urlString:urlString parameters:nil completed:completed];
}
//7.接口名称: 更新九宫格配置
//请求方式：PUT
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/HomeConf/{userId}
- (void)updateHomeConfWithResourceIdList:(NSArray<NSString *> *)resourceIdList completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    NSLog(@"%@",resourceIdList);
    //    [[self requestSerializer] setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    //    [[self requestSerializer] setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
    //    [[self requestSerializer] setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    //
    //    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    //    parameters[@"resourceIdList"] = resourceIdList;
    //
    //
    //
    //
    //    NSString *urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/HomeConf/%@",kUserInfo.userId];
    //
    //    [self requestWithMethod:PUT urlString:urlString parameters:parameters completed:completed];
    
    //sn_note:=========  ============================ stone 🐳 ===========/
    NSString *urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/HomeConf/%@",kUserInfo.userId];
    
    NSURL *url = [NSURL URLWithString:urlString];
    
    
    
    // 2. Request -> PUT,request的默认操作是GET
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    
    request.HTTPMethod = @"PUT";
    
    [request setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    [request setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
    [request setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    
    // 3. Session
    
    NSURLSession *session = [NSURLSession sharedSession];
    NSMutableString * strM;
    if (resourceIdList.count == 0) {
        strM = @"[]".mutableCopy;
    }else{
        strM = @"[".mutableCopy;
        for(int i = 0; i < resourceIdList.count; i++) {
            if (i == resourceIdList.count -1) {
                [strM appendFormat:@"%@]",resourceIdList[i]];
            }else{
                
                [strM appendFormat:@"%@,",resourceIdList[i]];
            }
            
        }
    }
    
    
    NSURLSessionUploadTask *upload = [session uploadTaskWithRequest:request fromData:[strM dataUsingEncoding:NSUTF8StringEncoding] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        
        NSLog(@"error = %@",error);
        
        NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:NULL];
        
        completed(dict,error);
        
        //  NSLog(@"%@",[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
        
    }];
    
    
    
    [upload resume];
}



/*
 获取验证码
 参数 :tel手机号
 
 */
- (void)gevfcodeTel:(NSString *)telPhone completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"phone"] = telPhone;
    parameters[@"time"] = @"201612";
    [[self requestSerializer]setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    NSString *urlString = @"https://www.zhuoyinong.com:444/hzsmng/rest/getvfcode";
    
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}



/*
 http://IP:8080/hzsmng/rest/chekcode/
 
 校验验证码
 */
- (void)checkCodephone:(NSString *)telPhone withVfcode:(NSString *)vfcode completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"phone"] = telPhone;
    parameters[@"vfcode"] = vfcode;
    
    [[self requestSerializer]setValue:[ZXTokenManager sharedManager].token forHTTPHeaderField:@"Authorization"];
    NSString *urlString = @"https://www.zhuoyinong.com:444/hzsmng/rest/chekcode";
    
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}




/*
 
 用户注册
 
 /hzsmng/rest/register
 
 */

- (void)registerParam:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSString *urlString = @"https://www.zhuoyinong.com:444/hzsmng/rest/register";
    
    [self requestWithMethod:POST urlString:urlString parameters:dict completed:completed];
}

///hzsmng/rest/vieworgbill

//查询组织清单
- (void)vieworgbillWithCustKind:(NSString *)custKind Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed
{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    
    parameters = @{
                   @"currentPage":@"1",
                   @"orgType":custKind,//custKind = 1 代表小农,返回合作社   custKind = 2 代表
                   @"provCode":@"230000",
                   @"cityCode":@"231200",
                   @"regiCode":@"231202"
                   }.mutableCopy;
    //hzsmng/rest/vieworgbill
    [self requestWithMethod:POST urlString:@"https://www.zhuoyinong.com:444/hzsmng/rest/vieworgbill" parameters:parameters completed:completed];
}




// 获取省份 - 地区 区县
- (void)getProvInfoCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed
{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"token"] = [ZXTokenManager sharedManager].token;
    parameters[@"timestamp"] = [NSDate new].toTimeStamp;//@"197001010800";
    
    [self requestWithMethod:POST urlString:@"https://www.zhuoyinong.com:444/hzsmng/rest/getProvInfo" parameters:parameters completed:completed];
}


- (void)getCityInfoProvId:(NSString *)provId Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed
{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"token"] = [ZXTokenManager sharedManager].token;
    parameters[@"timestamp"] = [NSDate new].toTimeStamp;//@"197001010800";
    parameters[@"provId"] = provId;
    [self requestWithMethod:POST urlString:@"https://www.zhuoyinong.com:444/hzsmng/rest/getCityInfo" parameters:parameters completed:completed];
}

- (void)getRegionInfoCityId:(NSString *)cityId Completed:(void (^)(NSDictionary * jsonDict, NSError * error))completed
{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"token"] = [ZXTokenManager sharedManager].token;
    parameters[@"timestamp"] = [NSDate new].toTimeStamp;//@"197001010800";
    parameters[@"cityId"] = cityId;
    [self requestWithMethod:POST urlString:@"https://www.zhuoyinong.com:444/hzsmng/rest/getRegionInfo" parameters:parameters completed:completed];
}















/**
 小额贷款登录
 
 @param completed 完成回调
 */
- (void)smallDKloginWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed
{
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    
    parameters = @{
                   @"loginName":@"admin",
                   @"password":@"zkbc",
                   
                   }.mutableCopy;
    
    [self requestWithMethod:POST urlString:smallDKlogin parameters:parameters completed:completed];
}

//小额贷款产品列表
- (void)sdpordListWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    /*
     pageNumber	第几页	string	非必填、
     pageSize	每页记录数	string	非必填、
     prodId	产品编号	string	非必填、
     prodName	产品名称	string	非必填、
     sessionId		string	必填、
     */
    parameters = @{
                   @"sessionId":[[NSUserDefaults standardUserDefaults] valueForKey:@"sessionId_key"],
                   }.mutableCopy;
    [self requestWithMethod:POST urlString:prodList parameters:parameters completed:completed];
}

//我的贷款
- (void)mydkListWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed{
    
    /*
     certNo	身份证号	string	必填、
     pageNumber	每页记录数	string	非必填、
     pageSize	第几页	string	非必填、
     sessionId		string	必填、
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    
    parameters[@"sessionId"] = [[NSUserDefaults standardUserDefaults] valueForKey:@"sessionId_key"];
    if (kUserInfo.busRepList[0].userId) {
        parameters[@"smId"] = kUserInfo.busRepList[0].userId;
    }
    parameters[@"certNo"] = kUserInfo.idCard;
    
    [self requestWithMethod:POST urlString:mydkList parameters:parameters completed:completed];
}


/**
 贷款预约
 
 @param dict cs
 @param completed hd
 */
- (void)dkYuyueWithParam:(NSDictionary *)parameters completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [self requestWithMethod:POST urlString:dkYuyue parameters:parameters completed:completed];
    
}


//贷款管理
- (void)mydkGuanliWithCompleted:(void (^)(NSDictionary * jsonDict, NSError * error))completed{
    
    /*
     certNo	农户身份证号	string	非必填、
     pageNumber	第几页	string	非必填、
     pageSize	每页记录数	string	非必填、
     sessionId		string	必填、
     smId	业务员ID	string	必填、
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    
    parameters = @{
                   @"sessionId":[[NSUserDefaults standardUserDefaults] valueForKey:@"sessionId_key"],
                   @"smId":kUserInfo.userId,
                   //                   @"certNo":kUserInfo.IDCARD
                   }.mutableCopy;
    
    [self requestWithMethod:POST urlString:dkGuanli parameters:parameters completed:completed];
}





//接口名称: 根据资源id获取文件。图片
//请求方式：get
//接口地址：
//http://139.129.199.137:8080/resources/api/v1/base/attach/{id}/down
- (void)getResourceWithResourceId:(NSString *)resourceId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSString * urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/base/attach/%@/down",resourceId];
    [self requestWithMethod:GET urlString:urlString parameters:nil completed:completed];
}
//接口名称: 修改密码
//请求方式：POST
//接口地址：
//https://www.zhuoyinong.com:444/hzsmng/rest/updatepassword

- (void)updatepasswordWithTime:(NSString *)time userId:(NSString *)userId phone:(NSString *)phone password:(NSString *)password newPassword:(NSString *)newPassword completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"time"] = time;
    parameters[@"userId"] = userId;
    parameters[@"phone"] = phone;
    parameters[@"password"] = password;
    parameters[@"newPassword"] = newPassword;
    
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/updatepassword"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 获取验证码
//请求方式：POST
//接口地址：
//https://www.zhuoyinong.com:444/hzsmng/rest/getvfcode

- (void)getvfcodeWithTime:(NSString *)time phone:(NSString *)phone completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"time"] = time;
    parameters[@"phone"] = phone;
    
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/getvfcode"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 忘记密码
//请求方式：POST
//接口地址：
//https://www.zhuoyinong.com:444/hzsmng/rest/forgetpassword

- (void)forgetpasswordWithTime:(NSString *)time phone:(NSString *)phone captcha:(NSString *)captcha password:(NSString *)password completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"time"] = time;
    parameters[@"phone"] = phone;
    parameters[@"captcha"] = captcha;
    parameters[@"password"] = password;
    
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/forgetpassword"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 验证码校验
//请求方式：POST
//接口地址：
//https://www.zhuoyinong.com:444/hzsmng/rest/chekcode/

- (void)chekcodeWithTime:(NSString *)time phone:(NSString *)phone vfcode:(NSString *)vfcode completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"time"] = time;
    parameters[@"phone"] = phone;
    parameters[@"vfcode"] = vfcode;
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/chekcode/"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 获取用户详细个人信息
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/getuserinfo/

- (void)getUserInfoWithUserId:(NSString *)userId certNo:(NSString *)certNo completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    //    parameters[@"certNo"] = @"";
    
    NSString * urlString = [NSString stringWithFormat:@"/hzsmng/rest/getuserinfo/"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 查询组织清单
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworgbill

- (void)vieworgbillWithProvCode:(NSString *)provCode cityCode:(NSString *)cityCode regiCode:(NSString *)regiCode custKind:(NSString *)custKind currentPage:(NSString *)currentPage completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"provCode"] = provCode;
    parameters[@"cityCode"] = cityCode;
    parameters[@"regiCode"] = regiCode;
    parameters[@"orgType"] = custKind;
    parameters[@"currentPage"] = currentPage;
    parameters[@"pageSize"] = @"999";
    
    NSString * urlString = [NSString stringWithFormat:@"/hzsmng/rest/vieworgbill"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 获取某一个社员详细信息
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/getUserDetail/

- (void)getUserDetailWithUserId:(NSString *)userId organId:(NSString *)organId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    parameters[@"organId"] = organId;
    
    NSString * urlString = [NSString stringWithFormat:@"/hzsmng/rest/getUserDetail/"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}

//接口名称: 获取组织详细信息
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/groupinfo/

- (void)groupinfoWithUserId:(NSString *)userId organId:(NSString *)organId completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     请求方式
     
     {"userId":"","organId":"HZS1612070988"}
     或者(二选一)
     {"userId":"bed5f376bba3437297c1e9f2228939ec","organId":""}
     */
    if (userId == nil) {
        userId = @"";
    }
    if (organId == nil) {
        organId = @"";
    }
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    parameters[@"organId"] = organId;
    
    NSString * urlString = [NSString stringWithFormat:@"/hzsmng/rest/groupinfo/"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//--------------------------------------------------------------------------
//接口名称: 获取组织信息
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo/
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo
- (void)viewOrgInfoWithUserId:(NSString *)userId orgtype:(NSString *)orgtype fullName:(NSString *)fullName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     {"userId":"efed7b7b5ace4aab9acedb479f9f8346",
     "shortName":"合作社","orgtype":"['1','2','3']"}
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    if (fullName.length > 0) {
        
        parameters[@"fullName"] = fullName;
    }
    //    parameters[@"orgtype"] = @"['1','2','3']";
    /** 1:合作社 2:农场 3:散户 */
    parameters[@"orgType"] = orgtype;
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 获取组织信息(有翻页功能)
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo/
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo
- (void)viewOrgInfoWithUserId:(NSString *)userId orgtype:(NSString *)orgtype fullName:(NSString *)fullName currentPage:(NSString *)currentPage pageSize:(NSString *)pageSize completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     {"userId":"efed7b7b5ace4aab9acedb479f9f8346",
     "shortName":"合作社","orgtype":"['1','2','3']"}
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    if (fullName.length > 0) {
        
        parameters[@"fullName"] = fullName;
    }
    //    parameters[@"orgtype"] = @"['1','2','3']";
    /** 1:合作社 2:农场 3:散户 */
    parameters[@"orgType"] = orgtype;
    
    parameters[@"currentPage"] = currentPage;
    parameters[@"pageSize"] = pageSize;
    
    NSLog(@"%@",@"//-------------------------");
    NSLog(@"%@",parameters);
    NSLog(@"%@",@"//-------------------------");
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/vieworginfo"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//--------------------------------------------------------------------------

//接口名称: 种植计划统计
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/plantingplan

- (void)plantingplanWithProvCode:(NSString *)provCode cityCode:(NSString *)cityCode regiCode:(NSString *)regiCode endMonth:(NSString *)endMonth completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"provCode"] = provCode;
    parameters[@"cityCode"] = cityCode;
    parameters[@"regiCode"] = regiCode;
    parameters[@"endMonth"] = endMonth;
    
    NSString * urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/plantingplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}



//接口名称: 业务代表提交审批生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/plancommit

- (void)planCommitWithPlanNo:(NSString *)planNo operator:(NSString *)operator completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"planNo"] = planNo;
    parameters[@"operator"] = operator;
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/plancommit"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}

//接口名称: 业务代表撤回生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/planrecall

- (void)planRecallWithPlanNo:(NSString *)planNo operator:(NSString *)operator completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"planNo"] = planNo;
    parameters[@"operator"] = operator;
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/planrecall"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}

//接口名称: 生产计划废除
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/planabolish

- (void)planAbolishWithPlanNo:(NSString *)planNo operator:(NSString *)operator completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"planNo"] = planNo;
    parameters[@"operator"] = operator;
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/planabolish"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}

//接口名称: 修改生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/updateplan

- (void)updateplanWithParams:(NSDictionary *)params  completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    [[self requestSerializer]setValue:@"application/json; Charset=UTF-8" forHTTPHeaderField:@"Accept"];
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/updateplan"];
    [self requestWithMethod:POST urlString:urlString parameters:params completed:completed];
}

//接口名称: 业务代表查询所管辖的人员的生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/viewruleplan

- (void)viewRulePlanWithUserId:(NSString *)userId custName:(NSString *)custName custPhone:(NSString *)custPhone orgType:(NSString *)orgType year:(NSString *)year currentPage:(NSString *)currentPage completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    parameters[@"custName"] = custName;
    parameters[@"custPhone"] = custPhone;
    parameters[@"orgType"] = orgType;
    parameters[@"year"] = year;
    parameters[@"currentPage"] = year;
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/viewruleplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}


//接口名称: 查看生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/viewplantplan

- (void)viewplantplanWithCustNo:(NSString *)custNo status:(NSString *)status year:(NSString *)year completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"custNo"] = custNo;
    // parameters[@"status"] = status;
    parameters[@"year"] = year;
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/viewplantplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//sn_note:=========  ============================ stone 🐳 ===========/
//接口名称: 查询年度计划名称列表
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/queryplanname

- (void)queryplannameWithToken:(NSString *)token timestamp:(NSString *)timestamp completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"token"] = [ZXTokenManager sharedManager].token;
    parameters[@"timestamp"] = [NSDate new].toTimeStamp;//@"197001010800";
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/queryplanname"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 业务代表查看所管辖的人员的生产计划接口
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/viewruleplan

- (void)viewruleplanWithUserId:(NSString *)userId year:(NSString *)year currentPage:(NSString *)currentPage pageSize:(NSString *)pageSize custName:(NSString*)custName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"userId"] = userId;
    parameters[@"year"] = year;//@"197001010800";
    parameters[@"currentPage"] = currentPage;
    parameters[@"pageSize"] = pageSize;
    
    if (custName != nil && custName.length > 0) {
        
        parameters[@"custName"] = custName;
    }
    
    
    NSLog(@"parameters = %@",parameters);
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/viewruleplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 业务代表撤回生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/planrecall

- (void)planrecallWithPlanNo:(NSString *)planNo operatorName:(NSString *)operatorName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     {
     "operator": "a7b6770a496b46df8250613129a666bb",
     "planNo": "20170112-SCJH10-264774"
     }
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"planNo"] = planNo;
    parameters[@"operator"] = operatorName;
    
    NSLog(@"parameters = %@",parameters);
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/planrecall"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 业务代表提交审批生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/plancommit

- (void)plancommitWithPlanNo:(NSString *)planNo operatorName:(NSString *)operatorName completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     {
     "operator": "a7b6770a496b46df8250613129a666bb",
     "planNo": "20170112-SCJH10-264774"
     }
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"planNo"] = planNo;
    parameters[@"operator"] = operatorName;
    
    NSLog(@"parameters = %@",parameters);
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/plancommit"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 修改生产计划
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/updateplan

- (void)updateplanWithDict:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    /*
     {
     "createTime": "2017-01-15 04:01:42",
     "cropType": 1,
     "custNo": "1484278873914",
     "fertList": [{
     "fertBrand": "rt",
     "fertContent": "1",
     "fertManu": "rt",
     "fertPerUse": 99.0990990990991,
     "fertPrice": 11.0,
     "fertTotal": 11.0,
     "fertTypes": "1",
     "id": "1a76358426d14fc089f712a702b122c6"
     }],
     "operator": "a7b6770a496b46df8250613129a666bb",
     "pestList": [{
     "id": "03230ccc29c246298d063ce069f40be1",
     "pestBrand": "ww",
     "pestManu": "ww",
     "pestPerUse": 99.0990990990991,
     "pestPrice": 11.0,
     "pestTotal": 11.0,
     "pestTypes": "qq"
     }],
     "planName": "2017年度生产计划",
     "planNo": "20170115-SCJH1-476207",
     "plantingArea": 111,
     "seedBrand": "tt",
     "seedManu": "rt",
     "seedPerUse": 198.1981981981982,
     "seedPrice": 11.0,
     "seedTotal": 11.0,
     "startTime": "2017-01",
     "status": 0
     }
     */
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters = dict.mutableCopy;
    NSLog(@"parameters = %@",parameters);
    
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/updateplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 生产计划编制(新建生产计划)
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/createplan

- (void)createplanWithDict:(NSDictionary *)dict completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters = dict.mutableCopy;
    NSLog(@"parameters = %@",parameters);
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/createplan"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 查询农户可用土地信息列表
//请求方式：POST
//接口地址：https://www.zhuoyinong.com:444/hzsmng/rest/querycustavailableland

- (void)querycustavailablelandWithCustNo:(NSString *)custNo address:(NSString *)address completed:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    NSMutableDictionary * parameters = [NSMutableDictionary dictionary];
    parameters[@"token"] = [ZXTokenManager sharedManager].token;
    parameters[@"timestamp"] = [NSDate new].dateToString(@"yyyyMMddHHmm");
    parameters[@"custNo"] = custNo;
    if (address.length > 0) {
        parameters[@"address"] = address;
    }
    NSLog(@"parameters = %@",parameters);
    NSString *urlString = [NSString stringWithFormat:@"https://www.zhuoyinong.com:444/hzsmng/rest/querycustavailableland"];
    [self requestWithMethod:POST urlString:urlString parameters:parameters completed:completed];
}
//接口名称: 广告图片集合
//请求方式：GET
//接口地址：http://139.129.199.137:8080/resources/api/v1/advertisement/down/

- (void)advertisementdownWithCompleted:(void (^)(NSDictionary *jsonDict, NSError *error))completed{
    
    NSString *urlString = [NSString stringWithFormat:@"http://139.129.199.137:8080/resources/api/v1/advertisement/down/"];
    [self requestWithMethod:GET urlString:urlString parameters:nil completed:completed];
}
@end
